let href = decodeURI(location.href)
let productId = href.split('?')[1].split('=')[1];
console.log(productId);

fetch('http://chst.vip:1234/api/getdiscountproduct?productid='+productId)
.then(function(a){
    return a.json();
})
.then(function(b){
    console.log(b);
    let str='';
    b.result.forEach(item => {
        // let src = item.productImg2.split('=')[3].split(" ")[0]
        // console.log(src);
        str +=      `<div>
                        ${item.productName}
                    </div>
                    <div>
                        ${item.productFrom} ${item.productTime} ${item.productTips} ${item.productPrice}
                    </div>
                    <div>
                        <p class="left">
                            ${item.productInfo}
                        </p>
                    </div>
                    <div>
                        ${item.productImg}
                    </div>
                    
                        
                    
                    <div>
                        <a href="#">前往购买</a>
                    </div>
                    <img src="http://chst.vip:8081/for-stu/wfzh/images/mmbweixin2.png" alt="">
                    
                    
                        ${item.productComment}`
    });
    $('main').html(str)
})